<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/include/taglibs.tag"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%@ include file="/WEB-INF/jsp/include/backBase.jsp"%>
<script type="text/javascript" src="<%=resources%>/myJs/back/channel.js"></script>
<title>栏目信息管理</title>
</HEAD>

<BODY>
	<div class="modal fade" id="channelInforModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
	<div class="modal fade" id="channelAddModal" tabindex="-1"
		role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<!-- 模态框（Modal） -->
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">添加栏目</h4>
				</div>
				<div class="modal-body">
					<form action="<%=ctx%>/back/channel/saveChannel.do" method="post">
						<p>栏目名称：</p>
						<p>
							<input type="text" name="name" class="form-control" />
						</p>
						<p>超链接：</p>
						<p>
							<input type="text" name="linkUrl" class="form-control" />
						</p>
						<p>描述：</p>
						<p>
							<input type="text" name="description" class="form-control" />
						</p>
						<input type="hidden" name="pid" value="0" />
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="submit" class="btn btn-primary">添加栏目</button>
						</div>
					</form>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	<div class="inc">
		<a class="btn btn-sm btn-primary"
			href="javascript:showModal('#channelAddModal')">添加主栏目</a> <a
			class="btn btn-sm btn-primary"
			href="javascript:addSelectBox('#del-channels')">批量删除</a>
	</div>
	<table class="table table-hover">
		<thead>
			<tr>
				<th>栏目名称</th>
				<th>超链接</th>
				<th>文章数量</th>
				<th>栏目位置</th>
				<th class="channel-option">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${lc }" var="c">
				<tr style="color:red">
					<td><div class="check-box" id="${c.id }"></div> ${c.name}</td>
					<td>${c.linkUrl}</td>
					<td>0</td>
					<td>${c.pos}</td>
					<td class="channel-option"><a
						href="javascript:showModal('#channelAddModal');setPid('#channelAddModal','${c.id }')">添加子栏目</a>|
						<a href="javascript:deleteFrame('#del-channel','${c.id }');">删除</a>|
						<a
						href="javascript:ajaxShow('<%=ctx%>/ajax/showChannel.do','#channelInforModal','${c.id }')">编辑</a></td>
				</tr>
				<c:forEach items="${c.children }" var="cc">
					<tr class="son-channel active" style="color:green">
						<td><div class="check-box" id="${cc.id }"></div> ${cc.name }</td>
						<td>${cc.linkUrl }</td>
						<td>0</td>
						<td>${cc.pos }</td>
						<td class="channel-option"><a
							href="javascript:deleteFrame('#del-channel','${cc.id }');">删除</a>|
							<a
							href="javascript:ajaxShow('<%=ctx%>/ajax/showChannel.do','#channelInforModal','${cc.id }')">编辑</a></td>
					</tr>
				</c:forEach>
			</c:forEach>
		</tbody>
	</table>
	<form style="display: none;"
		action="<%=ctx%>/back/channel/deleteChannel.do" method="post"
		id="del-channel">
		<input name="id" type="hidden" />
	</form>
	<form style="display: none;"
		action="<%=ctx%>/back/channel/deleteChannels.do" method="post"
		id="del-channels">
		<input name="ids" type="hidden" />
	</form>

</BODY>
</HTML>
